<?php

require_once __DIR__ .'/vendor/autoload.php';

$cli = new \League\CLImate\CLImate();

$cli->backgroundGreen()->description('yitu8 crontab!');
$cli->backgroundGreen()->flank('yitu8 crontab!', '!', 5);


try {
    $cli->arguments->add([
        'help' => [
            'longPrefix' => 'help',
            'prefix' => 'h',
            'description' => 'help message',
            'castTo' => 'string',
            'required' => false,
            'defaultValue' => '',
            'noValue' => true
        ],
        'env' => [
            'longPrefix' => 'env',
            'prefix' => 'e',
            'description' => 'env message pro ptr test dev',
            'castTo' => 'string',
            'required' => true,
            'defaultValue' => 'ptr',
            'noValue' => true
        ],
        'item' => [
            'longPrefix' => 'item',
            'prefix' => 'i',
            'description' => 'item message freeTime',
            'castTo' => 'string',
            'required' => true,
            'defaultValue' => 'freeTime',
            'noValue' => true
        ],
    ]);
} catch (Exception $e) {
    $cli->to('error')->red($e->getMessage());
}

$cli->usage();

try {
    $cli->arguments->parse();
} catch (Exception $e) {
    $cli->to('error')->red($e->getMessage());
}

$env = $cli->arguments->get('env');

$cli->red('env :'.$env);

/*$input = $cli->input('select options ?');

//$input->multiLine();

$input->accept(['Fine', 'Ok'], true);
$input->strict();
$input->defaultTo('Ok');

$response = $input->prompt();
var_export($response);*/

$data = [
    [
        'Walter White',
        'Father',
        'Teacher',
    ],
    [
        'Skyler White',
        'Mother',
        'Accountant',
    ],
    [
        'Walter White Jr.',
        'Son',
        'Student',
    ],
];

$data = [
    [
        'name'       => 'Walter White',
        'role'       => 'Father',
        'profession' => 'Teacher',
    ],
    [
        'name'       => 'Skyler White',
        'role'       => 'Mother',
        'profession' => 'Accountant',
    ],
    [
        'name'       => 'Walter White Jr.',
        'role'       => 'Son',
        'profession' => 'Student',
    ],
];

$cli->table($data);
$cli->border('-*-');
$data = [
    ['Gary', 'Mary', 'Larry', 'Terry'],
    [1.2, 4.3, 0.1, 3.0],
    [6.6, 4.4, 5.5, 3.3],
    [9.1, 8.2, 7.3, 6.4],
];

$cli->columns($data);

$cli->border('-*-', 50);
$padding = $cli->padding(30)->char('-');

$padding->label('Eggs')->result('$1.99');
$padding->label('Oatmeal')->result('$4.99');
$padding->label('Bacon')->result('$2.99');

//$cli->clear();

$cli->json([
    'name' => 'Gary',
    'age'  => 52,
    'job'  => 'Engineer',
]);

$cli->dump([
    'This',
    'That',
    'Other Thing',
]);




/*$cli->br(2);

$writers = $cli->output->getAvailable();

$cli->red()->bold()->underline()->backgroundGreen()->out(var_export($writers, true));*/
